local anji = fk.CreateSkill {
  name = "anji",
  tags = { Skill.Compulsory },
}

Fk:loadTranslationTable{
  ["anji"] = "谙计",
  [":anji"] = "锁定技，当一名角色使用基本牌时，若你没有该牌花色的手牌或该牌为无色，你摸一张牌。",
  ["$anji1"] = "兵法谙熟于胸，今乃施为之时。",
  ["$anji2"] = "我军待时而动，以有备击不备。",
}

anji:addEffect(fk.CardUsing, {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    -- 检查是否为锁定技拥有者且使用的是基本牌
    if player:hasSkill(anji.name) and data.card.type == Card.TypeBasic then
      local card_suit = data.card.suit
      -- 无色牌直接满足条件
      if card_suit == Card.NoSuit or
            not table.find(player:getCardIds("h"), function(id)
        return Fk:getCardById(id).suit == card_suit
      end) then
        return true
      end
    end
  end,
      -- 检查是否有同花色手牌


  on_use = function(self, event, target, player, data)
    -- 触发摸牌效果
    player:drawCards(1, anji.name)
  end,
})

return anji
